//
//  WJTableViewCell.m
//  KMedicine
//
//  Created by wangjun on 16/7/7.
//  Copyright © 2016年 caomu. All rights reserved.
//

#import "WJTableViewCell.h"

@implementation WJTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    
    //设置iconImageView
    UIImageView *iconImageView = [[UIImageView alloc]init];
    self.iconImage = iconImageView;
    [self.contentView addSubview:iconImageView];
    
    UILabel *titleLabel = [[UILabel alloc]init];
    self.titleLabel = titleLabel;
    self.titleLabel.text = @"用户协议";
    [self.titleLabel sizeToFit];
    [titleLabel setFont:[UIFont systemFontOfSize:17]];
    [titleLabel setTextColor:[UIColor blueColor]];
    [self.contentView addSubview:titleLabel];
    
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    [self setContraint];
}

- (void)setContraint{
    
    [self.iconImage makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(5);
        make.leading.equalTo(self.contentView).offset(15);
        make.height.equalTo(20);
        
        
    }];
    
    [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
       
        make.leading.equalTo(self.iconImage.trailing).offset(15);
        make.centerY.mas_equalTo(self.iconImage.mas_centerY);
    }];
    
}
@end
